<?php

class Account_Model extends CI_Model {

    private $table = 'accounts';

    public function __construct() {
        parent::__construct();
        $this->load->database();
    }

    public function get($fb_id) {
        $this->db->where('fb_id', $fb_id);
        $this->db->order_by('id', 'DESC');
        $query = $this->db->get($this->table);
        return is_object($query) ? $query->result_array() : FALSE;
    }

    public function create($data) {
        $this->db->insert($this->table, $data);
        return $this->db->insert_id();
    }

    public function update($id, $data) {
        $this->db->where('id', $id);
        return $this->db->update($this->table, $data);
    }

}
